dojo.provide("miaigo.view.CommentsView");

dojo.require("miaigo.view.BaseView");
dojo.require("dijit._Templated");

dojo.declare(
    "miaigo.view.CommentsView",
    [miaigo.view.BaseView, dijit._Templated],
    {
	templateString: "<div dojoAttachPoint='containerNode' style='height:10em;'>This will be the Comments View</div>",

	_connDefs:
	{
	    inbound:
	    [
		{ event: "onCurrentMoveChanged", method: "onMove" }
	    ]
	},

	onMove: function(/* miaigo.model.Move */move)
	{
	    var node = move ? move.srcNode : null;
	    if (node)
	    {
		var comment = node.getAttribute("comment");
		if (comment)
		{
		    this.containerNode.innerHTML = comment;
		}
		else
		{
		    this.showNoCommentMessage();
		}
	    }
	},

	showNoCommentMessage: function()
	{
	    this.containerNode.innerHTML = "<span style='color:silver;'>No Comment</span>"
	}
    });